<template>
    <div>
        <h1>{{article.title}}</h1>
        <div>
            <img :src="article.imgUrl" alt="" width="400" height="200">
        </div>
        <div>
            {{article.content}}
        </div>
    </div>
</template>

<script>
export default {
    name:'article',
    data(){
        return {
            article:{}
        }
    },
    mounted(){
      this.getArticle();
    },
    methods:{
        getArticle(){
            this.$axios.get('/api/article/'+this.$route.params.id)
            .then((data)=>{
                this.article = data.data;
            })
            .catch( (error) => {
                // 处理错误情况
                console.log(error);
            });
        }
    }

}
</script>